package com.bqtv.sport.ui.mine

import android.content.Context
import android.content.Intent
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.bqtv.sport.adapter.ActivityCenterAdapter
import com.bqtv.sport.app.AppActivity
import com.bqtv.sport.commen.widget.LinearItemDecoration
import com.bqtv.sport.databinding.ActivityActivityCenterBinding

class ActivityCenterActivity : AppActivity<ActivityActivityCenterBinding>() {
    private lateinit var centerAdapter: ActivityCenterAdapter

    companion object {
        fun start(context: Context) {
            val intent = Intent(context, ActivityCenterActivity::class.java)
            context.startActivity(intent)
        }
    }

    override fun getViewBinding() = ActivityActivityCenterBinding.inflate(layoutInflater)

    override fun initView() {
        binding.rcvData.layoutManager = LinearLayoutManager(this)
        binding.rcvData.addItemDecoration(
            LinearItemDecoration(
                getContext(),
                LinearItemDecoration.LineDrawMode.VERTICAL,
                0f,
                10f,
                10f
            )
        )
        centerAdapter = ActivityCenterAdapter()
        binding.rcvData.adapter = centerAdapter
    }

    override fun initData() {
        centerAdapter.submitList(arrayListOf("1", "2", "3"))


        initListener()
    }

    private fun initListener() {
        centerAdapter.setOnItemClickListener { adapter, view, position ->
            ActivityDetailActivity.start( this)
        }
    }

    override fun onClick(view: View) {
        super.onClick(view)
        when (view) {

        }
    }
}